package com.uinnova.product.eam.mvc;

import com.binary.framework.web.RemoteResult;
import com.uinnova.product.eam.model.es.DiagramThumbnail;
import com.uinnova.product.eam.service.DiagramThumbnailService;
import com.uinnova.product.eam.vo.DiagramThumbnailSaveReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/diagram/thumbnail")
public class DiagramThumbnailMvc {

    @Autowired
    private DiagramThumbnailService diagramThumbnailService;

    @PostMapping("/save")
    public RemoteResult save(@RequestBody List<DiagramThumbnailSaveReq> reqs) {
        List<DiagramThumbnail> diagramThumbnails = diagramThumbnailService.saveDiagramThumbnail(reqs);
        return new RemoteResult(diagramThumbnails);
    }

    @GetMapping("/list")
    public RemoteResult list(@RequestParam String diagramId) {
        List<DiagramThumbnail> diagramThumbnails = diagramThumbnailService.list(diagramId);
        return new RemoteResult(diagramThumbnails);
    }

}
